fix(workflow): honor definition 'enabled' flag on upsert - #2956
fix(workflow): honor definition 'enabled' flag on upsert#2956flaukowski wants to merge 1 commit into
Conversation
fd14710 to
bf64c0d
Compare
upsert_workflow's ON CONFLICT DO UPDATE set name/definition/hash but never enabled, so re-publishing a kind:30620 definition with enabled: false changed the stored JSON while leaving the row enabled=TRUE — a disabled workflow kept firing on its schedule. Parse enabled from the definition and apply it on both insert and update. Co-Authored-By: Claude Fable 5 <[email protected]> Signed-off-by: flaukowski <[email protected]> (cherry picked from commit 96e1688)
bf64c0d to
8de1cce
Compare
|
@tlongwell-block — flagging this your way as the most recent author of Rebased onto current Worth surfacing since it may raise the priority: this is a still-live half of #1593. That issue concludes that after #1369's d-tag upsert landed, "all new operations behave correctly" — but disable-via-redefinition is still a no-op on current
|
upsert_workflow'sON CONFLICT DO UPDATEsetsname/definition/definition_hashbut neverenabled. Re-publishing a kind:30620 workflow definition withenabled: falsetherefore updates the stored JSON while leaving the row'senabledcolumnTRUE— a disabled scheduled workflow keeps firing.This parses
enabledfrom the definition (WorkflowDef.enabled, default true) and applies it on both insert and update. Minimal, contained to the DB helper; no signature change.Found while disabling a scheduled workflow via a re-published definition.
Related work
#1593 reports workflows that "keep firing on their cron schedules and cannot be disabled", and attributes it to orphan rows created before #1369, stating that after the d-tag upsert landed "all new operations behave correctly".
That is still not true for the disable path on current
main, for a separate reason: the upsert'sON CONFLICT DO UPDATEnever writes theenabledcolumn, so re-publishing a definition withenabled: falseupdates the JSON and leaves the row enabled. No orphan row required — this reproduces on a workflow created today.This PR fixes that half. #1593's orphan reconciliation (and its point 2, surfacing side-effect failures) is still needed for the legacy rows.
Rebased onto current
main;cargo clippy -p buzz-dbis clean.